home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Includes / dpkernel / dpkernel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-11  |  9.1 KB  |  303 lines

  1. #ifndef DPKERNEL_H
  2. #define DPKERNEL_H TRUE
  3.  
  4. /*
  5. **   $VER: dpkernel.h V2.1
  6. **
  7. **   General include file for programs using the dpkernel.
  8. **
  9. **   (C) Copyright 1996-1998 DreamWorld Productions.
  10. **       All Rights Reserved.
  11. */
  12.  
  13. #ifndef SYSTEM_TYPES_H
  14. #include <system/types.h>
  15. #endif
  16.  
  17. #ifndef SYSTEM_REGISTER_H
  18. #include <system/register.h>
  19. #endif
  20.  
  21. /***************************************************************************/
  22.  
  23. #define DPKVersion  2
  24. #define DPKRevision 1
  25.  
  26. #define   M68K_REGISTERS TRUE
  27. #define   M68K_CPU       TRUE
  28. #define   MACHINE_AMIGA  TRUE
  29. /*#define MACHINE_MAC    FALSE */
  30. /*#define MACHINE_IBMPC  TRUE  */
  31. /*#define PENTIUM_CPU    TRUE  */
  32. /*#define _USE_DPKBASE   TRUE  */
  33.  
  34. #define MISSION_CRITICAL TRUE
  35.  
  36. #ifdef __SASC
  37.   #define LIBPTR  __asm
  38.   #define LIBFUNC __asm __saveds
  39.   #define FUNC    __asm
  40.   #define mreg(r) register r
  41.   #define FNCALL inline
  42. #else
  43.  #ifdef _DCC
  44.    #define LIBPTR
  45.    #define LIBFUNC
  46.    #define FUNC
  47.    #define mreg(r) r
  48.    #define FNCALL inline
  49.  #else
  50.    #define LIBPTR
  51.    #define LIBFUNC
  52.    #define FUNC
  53.    #define mreg(r)
  54.    #define FNCALL inline
  55.  #endif
  56. #endif
  57.  
  58. /****************************************************************************
  59. ** Tag definitions.
  60. */
  61.  
  62. #define SKIPENTRY   0
  63. #define ENDLIST     -1
  64. #define LISTEND     -1
  65. #define TAGEND      0
  66. #define DEFAULT     0
  67.  
  68. #define TBYTE       0L
  69. #define TLONG       (1L<<31)
  70. #define TWORD       (1L<<30)
  71. #define TAPTR       (1L<<29)|TLONG
  72. #define TSTEPIN     (1L<<28)
  73. #define TSTEPOUT    (1L<<27)
  74. #define TTRIGGER    (1L<<26)
  75.  
  76. #define TALLTAGS    (TBYTE|TLONG|TWORD|TAPTR|TSTEPIN|TSTEPOUT|TTRIGGER)
  77.  
  78. #ifndef TAG_IGNORE
  79.  #ifdef MACHINE_AMIGA
  80.   #include <utility/tagitem.h>
  81.  #else
  82.   typedef ULONG Tag;
  83.   struct TagItem {
  84.     Tag    ti_Tag;        /* Identifies the type of data */
  85.     ULONG ti_Data;       /* Type-specific data */
  86.   };
  87.  
  88.   #define TAG_IGNORE  (1L)
  89.   #define TAG_MORE    (2L)
  90.   #define TAG_SKIP    (3L)
  91.  #endif
  92. #endif /* TAG_IGNORE */
  93.  
  94. /****************************************************************************
  95. ** ID flags for Get().
  96. */
  97.  
  98. #define GET_NOTRACK (0x00010000L)
  99. #define GET_PUBLIC  (0x00020000L)
  100. #define GET_SHARE  ((0x00040000L)|GET_PUBLIC)
  101.  
  102. /****************************************************************************
  103. ** Function synonyms.
  104. */
  105.  
  106. #define DMsg(a)    DPrintF(NULL,a)
  107. #define EMsg(a)    DPrintF("Error:",a)
  108.  
  109. #define Display(a)   Show(a)
  110. #define Visible(a)   Show(a)
  111. #define Invisible(a) Hide(a)
  112. #define GetParent(a) GetContainer(a)
  113.  
  114. /****************************************************************************
  115. ** Header used for all objects.
  116. */
  117.  
  118. struct Head {
  119.   WORD   ID;
  120.   WORD   Version;
  121.   struct SysObject *Class;
  122.   struct Stats     *Stats;
  123. };
  124.  
  125. /****************************************************************************
  126. ** The Stats structure is private to the system, and is handled by Get()
  127. */
  128.  
  129. struct Stats {
  130.   LONG empty;                /* */
  131.   APTR Private;              /* A reserved pointer for use by child objects */
  132.   LONG Flags;                /* General flags */
  133.   struct DPKTask *Exclusive; /* Tells us who owns any exclusive lock */
  134.   WORD LockCount;            /* A running count of active locks if nesting */
  135.   WORD emp;                  /* */
  136.   LONG MemFlags;             /* Recommended memory allocation flags */
  137.   APTR Container;            /* Set if the object was initialised to a container */
  138.   struct Resource *ResourceList;
  139.   LONG TotalData;            /* Total data/code memory */
  140.   LONG TotalVideo;           /* Total video memory */
  141.   LONG TotalSound;           /* Total sound memory */
  142.   LONG TotalBlit;            /* Total blitter memory */
  143. };
  144.  
  145. #define ST_SHARED      0x00000001L  /* The object is being openly shared */
  146. #define ST_EXCLUSIVE   0x00000002L  /* If the object is exclusive to a task */
  147. #define ST_PUBLIC      0x00000004L  /* If the object can be passed around */
  148. #define ST_NOTRACKING  0x00000008L  /* Do not track resources on this object */
  149. #define ST_INITIALISED 0x00000010L  /* This is set by Init() */
  150.  
  151. struct Resource {
  152.   struct Resource *Prev;  /* Previous resource on chain */
  153.   struct Resource *Next;  /* Next resource on chain */
  154.   APTR Pointer;           /* Pointer to the resource */
  155.   WORD Type;              /* RSF_OBJECT, RSF_MEMORY */
  156. };
  157.  
  158. #define RSF_OBJECT   1
  159. #define RSF_MEMORY   2
  160. #define RSF_HARDWARE 3
  161. #define RSF_ROUTINE  4
  162.  
  163. /****************************************************************************
  164. ** Raw Data object.
  165. */
  166.  
  167. #define VER_RAWDATA  1
  168. #define TAGS_RAWDATA ((ID_SPCTAGS<<16)|ID_RAWDATA)
  169.  
  170. struct RawData {
  171.   struct Head Head;  /* Standard structure header */
  172.   LONG   Size;       /* Size of the data in bytes */
  173.   APTR   Data;       /* Pointer to the data */
  174.  
  175.   /*** Private fields below ***/
  176.  
  177.   BYTE prvAFlags;    /* Private */
  178.   BYTE prvPad;       /* Private */
  179. };
  180.  
  181. /****************************************************************************
  182. ** List object.
  183. */
  184.  
  185. #define VER_ITEMLIST  1
  186. #define TAGS_ITEMLIST ((ID_SPCTAGS<<16)|ID_ITEMLIST)
  187.  
  188. struct ItemList {
  189.   struct Head Head;  /* Standard header */
  190.   APTR   *Array;     /* Pointer to the list's array, terminated with -1 */
  191.   LONG   MaxSize;    /* Maximum amount of objects that this list can hold */
  192.  
  193.   /*** Private fields below ***/
  194.  
  195.   APTR   prvMemory;
  196. };
  197.  
  198. /****************************************************************************
  199. ** Universal errorcodes returned by certain functions.
  200. */
  201.  
  202. #define ERR_OK            0  /* Function went OK (also NULL) */
  203. #define ERR_NOMEM         1  /* Not enough memory available */
  204. #define ERR_NOPTR         2  /* Required pointer not present */
  205. #define ERR_INUSE         3  /* Previous allocations have not been freed */
  206. #define ERR_STRUCT        4  /* Structure version not supported or not found */
  207. #define ERR_FAILED        5  /* General failure */
  208. #define ERR_FILE          6  /* File error, eg file not found */
  209. #define ERR_BADDATA       7  /* There is an error in the given data */
  210. #define ERR_SEARCH        8  /* A search routine in this function failed */
  211. #define ERR_SCRTYPE       9  /* Screen type not recognised */
  212. #define ERR_MODULE       10  /* Trouble initialising/using a module */
  213. #define ERR_RASTCOMMAND  11  /* Invalid raster command detected */
  214. #define ERR_RASTERLIST   12  /* Complete rasterlist failure */
  215. #define ERR_NORASTER     13  /* Expected rasterlist is missing from Screen */
  216. #define ERR_DISKFULL     14  /* Disk full error */
  217. #define ERR_FILEMISSING  15  /* File not found */
  218. #define ERR_WRONGVER     16  /* Wrong version or version not supported */
  219. #define ERR_MONITOR      17  /* Monitor driver not found or cannot be used */
  220. #define ERR_UNPACK       18  /* Problem with unpacking of data */
  221. #define ERR_ARGS         19  /* Invalid arguments passed to function */
  222. #define ERR_NODATA       20  /* No data is available for use */
  223. #define ERR_READ         21  /* Error reading data from file */
  224. #define ERR_WRITE        22  /* Error writing data to file */
  225. #define ERR_LOCK         23  /* Could not obtain lock on object */
  226. #define ERR_EXAMINE      24  /* Could not examine directory or file */
  227. #define ERR_LOSTCLASS    25  /* This object has lost its class reference */
  228. #define ERR_NOACTION     26  /* This object does not support the required action */
  229. #define ERR_NOSUPPORT    27  /* Object does not support the given data */
  230. #define ERR_MEMORY       28  /* General memory error */
  231. #define ERR_TIMEOUT      29  /* Function timed-out before successful completion */
  232. #define ERR_NOSTATS      30  /* This object has lost its stats structure */
  233. #define ERR_GET          31  /* Error in Get()ing an object */
  234. #define ERR_INIT         32  /* Error in Init()ialising an object */
  235. #define ERR_NOPERMISSION 33  /* Security violation */
  236.  
  237. /*** Synonyms ***/
  238.  
  239. #define ERR_SUCCESS   ERR_OK
  240. #define ERR_DATA      ERR_BADDATA
  241. #define ERR_LOSTSTATS ERR_NOSTATS
  242. #define ERR_NOCLASS   ERR_LOSTCLASS
  243. #define ERR_STATS     ERR_NOSTATS
  244. #define ERR_SECURITY  ERR_NOPERMISSION
  245.  
  246. /****************************************************************************
  247. ** Memory types used by AllocMemBlock().  This is generally identical to the
  248. ** exec definitions but CHIP is renamed to VIDEO (displayable memory) and
  249. ** there is an addition of BLIT and SOUND specific memory.
  250. */
  251.  
  252. #define MEM_DATA      0
  253. #define MEM_PUBLIC    (1L<<0)
  254. #define MEM_VIDEO     (1L<<1)
  255. #define MEM_BLIT      (1L<<2)
  256. #define MEM_SOUND     (1L<<3)
  257. #define MEM_CODE      (1L<<4)
  258. #define MEM_PRIVATE   (1L<<5)
  259. #define MEM_NOCLEAR   (1L<<6)
  260. #define MEM_RESOURCED (1L<<7)
  261. #define MEM_UNTRACKED (1L<<31)
  262.  
  263. #define MEM_AUDIO     MEM_SOUND
  264.  
  265. #define AllocPublic(size,flags) AllocMemBlock((size),(flags)|MEM_PUBLIC)
  266. #define AllocPrivate(size,flags) AllocMemBlock((size),(flags)|MEM_PRIVATE)
  267.  
  268. /***************************************************************************/
  269.  
  270. #ifndef SYSTEM_MISC_H
  271. #include <system/misc.h>
  272. #endif
  273.  
  274. #ifndef SYSTEM_MODULES_H
  275. #include <system/modules.h>
  276. #endif
  277.  
  278. #ifndef GRAPHICS_BLITTER_H
  279. #include <graphics/blitter.h>
  280. #endif
  281.  
  282. #ifndef GRAHICS_PICTURES_H
  283. #include <graphics/pictures.h>
  284. #endif
  285.  
  286. #ifndef GRAPHICS_SCREENS_H
  287. #include <graphics/screens.h>
  288. #endif
  289.  
  290. #ifndef INPUT_JOYPORTS_H
  291. #include <input/joyports.h>
  292. #endif
  293.  
  294. #ifndef SOUND_SOUND_H
  295. #include <sound/sound.h>
  296. #endif
  297.  
  298. #ifndef FILES_FILES_H
  299. #include <files/files.h>
  300. #endif
  301.  
  302. #endif /* DPKERNEL_H */
  303.